package com.jy.modules.cims.component.creditRight;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.jy.modules.cims.data.common.dto.TCMmCooperorgDealDTO;
import com.jy.modules.cims.data.common.dto.TCMmCreditDealDetailDTO;
import com.jy.modules.cims.data.common.dto.TCMmCreditDetailDTO;
import com.jy.modules.cims.data.common.dto.TCMmQuotaCreditDetailDTO;
import com.jy.modules.cims.data.dto.CreditDetailDto;
import com.jy.modules.cims.data.dto.CreditDetailSecondDto;
import com.jy.modules.cims.data.dto.CreditRightDto;
import com.jy.modules.cims.data.dto.DealDetailDto;
import com.jy.modules.cims.data.dto.DealDto;
import com.jy.modules.cims.data.dto.QuotaCreditDetailDto;
import com.jy.modules.cims.data.dto.QuotaCreditRightDto;
import com.jy.modules.cims.data.dto.QuotaDetailUnlockParamDto;
import com.jy.modules.cims.data.dto.RedemptionCreditDetailDto;
import com.jy.modules.cims.data.dto.credit.CreditTwoBuyMatchDto;
import com.jy.modules.cims.data.dto.credit.CreditTwoBuyRepayDto;
import com.jy.modules.cims.data.dto.credit.CreditTwoBuySettleDto;
import com.jy.modules.cims.data.dto.credit.SecondBuyCreditConfirmDto;
import com.jy.modules.cims.data.interact.api.request.RequestCreditRedemptionListDTO;
import com.jy.platform.core.common.BaseDTO;

/**
 * 债权相关处理组件
 */
public interface ICCreditRight {

	/**
	 * 保存债权信息
	 * 
	 * @param dto
	 * @return
	 */
	public void saveInfo(CreditRightDto dto);

	/**
	 * 交易明细对象转成债权对象
	 * 
	 * @param detail
	 * @return
	 */
	public CreditRightDto dealDetailToCreditRight(DealDetailDto detail);

	/**
	 * 债权对象转成交易明细对象
	 * 
	 * @param dto
	 * @return
	 */
	public DealDetailDto creditRightToDealDetail(CreditRightDto dto);

	/**
	 * 删除债权信息
	 */
	public void deleteInfo();

	/**
	 * @author zhiqiang
	 * @description: 更新对象T_C_MM_QUOTA_CREDIT_DETAIL
	 * @date 2015-01-12 20:34:29
	 * @param paramMap
	 */
	public void updateTCMmQuotaCreditDetailStatus(TCMmQuotaCreditDetailDTO qdto);
	/**
	 * @author zhiqiang
	 * @description: 更新对象T_C_MM_CREDIT_DETAIL
	 * @date 2015-01-12 20:34:29
	 * @param paramMap
	 */
	public void updateCreditDetailStatus(RedemptionCreditDetailDto redemptionCreditDetailDto);
	/**
	 * @Title updateCreditDetailStatusByCreditCode
	 * @Description TODO
	 * @param qdto 
	 * void 
	 * @author lizhiqiang
	 * @date 2015-5-10-下午4:32:46
	 * @update 
	 * @throws
	 */
	public void updateCreditDetailStatusByCreditCode(List<CreditDetailDto> creditDealList,Map<Object, Object> paramterMap);
	/**
	 * 
	 * @Title updateTCMmQuotaCreditDetailStatusByIds
	 * @Description TODO
	 * @param qdto
	 *            void
	 * @author lizhiqiang
	 * @date 2015-1-23-下午2:59:42
	 * @update
	 * @throws
	 */
	public void updateTCMmQuotaCreditDetailStatusByTransferIds(
			QuotaCreditRightDto qdto);

	/**
	 * 
	 * @Title deleteTCMmCreditDealDetailByTransferIds
	 * @Description 删除没有进行交易的已操作的债权信息
	 * @param baseDto
	 * @param ids
	 *            void
	 * @author lizhiqiang
	 * @date 2015-1-23-下午3:40:40
	 * @update
	 * @throws
	 */
	public void deleteTCMmCreditDealDetailByTransferIds(BaseDTO baseDto,
			String ids ,String dealCode);

	/**
	 * 
	 * @Title deleteTCMmCreditDetailByTransferIds
	 * @Description TODO
	 * @param baseDto
	 * @param ids
	 *            void
	 * @author lizhiqiang
	 * @date 2015-1-23-下午4:13:35
	 * @update
	 * @throws
	 */
	public void deleteTCMmCreditDetailByTransferIds(BaseDTO baseDto, String ids);

	/**
	 * 插入债权交易明细
	 */
	public void saveCreditDealDetail(QuotaCreditRightDto qcreditdto,
			TCMmCooperorgDealDTO dealdto);
	/**
	 * 把额度债权明细保存到债权交易明细
	 * @Title saveCreditDealDetailByQuotaCredit
	 * @Description TODO
	 * @param qcreditdto 
	 * void 
	 * @author lizhiqiang
	 * @date 2015-8-14-上午11:11:02
	 * @update 
	 * @throws
	 */
	public void saveCreditDealDetailByQuotaCredit(QuotaCreditDetailDto qcreditdtoList);
	/**
	 * 插入赎回债权交易明细
	 */
	public void saveRedemptionCreditDealDetail(RedemptionCreditDetailDto redemptionCreditDetailDto,
			TCMmCooperorgDealDTO dealdto);
	/**
	 * 插入赎回债权交易明细
	 */
	public void saveRedemptionCreditDealDetail(List<CreditDetailDto> creditDealList,
			DealDto dealDto);

	/**
	 * 插入债权明细
	 * 
	 * @Title saveCreditDetail
	 * @Description TODO
	 * @param creditdto
	 * @param dealdto
	 *            void
	 * @author lizhiqiang
	 * @date 2015-2-2-下午4:22:49
	 * @update
	 * @throws
	 */
	public QuotaDetailUnlockParamDto saveCreditDetail(
			QuotaCreditRightDto qcreditdto, TCMmCooperorgDealDTO dealdto) throws Exception ;

	/**
	 * 额度债权明细保存到债权明细
	 * @Title saveCreditDetail
	 * @Description TODO
	 * @param quotaCreditDetailDto
	 * @throws Exception 
	 * void 
	 * @author lizhiqiang
	 * @date 2015-8-14-上午11:50:23
	 * @update 
	 * @throws
	 */
	public void saveCreditDetailByQuotaCredit(QuotaCreditDetailDto quotaCreditDetailDto) throws Exception ;

	/**
	 * @description 根据额度申请查询获取额度明细
	 * @param dto
	 * @return
	 */
	public List<QuotaCreditDetailDto> getQuotaCreditDetailByQuotaCreditDetail(
			QuotaCreditDetailDto dto);
	/**
	 * 批量插入债权交易明细
	 * @Title insertCreditDealDetailBatch
	 * @Description TODO
	 * @param dlist 
	 * void 
	 * @author lizhiqiang
	 * @date 2015-4-18-下午2:20:26
	 * @update 
	 * @throws
	 */
	public void insertCreditDealDetailByBatch(List<TCMmCreditDealDetailDTO> dlist);
	/**
	 * 批量插入债权明细
	 * @Title insertCreditDetailByBatch
	 * @Description TODO
	 * @param dlist 
	 * void 
	 * @author lizhiqiang
	 * @date 2015-4-29-上午11:47:25
	 * @update 
	 * @throws
	 */
	public void insertCreditDetailByBatch(List<TCMmCreditDetailDTO> dlist);
	
	/**
	 * @Description 批量修改额度债权明细
	 * @author shengzhoutao
	 * @param paramMap
	 * @return
	 */
	public int updateQuotaCreditDetailDealStatus(Map<String, Object> paramMap);
	/**
	 * 按照交易流水号查询债权明细的债权价值合计
	 * @Title getSumThisMakeCreditValueByDealCode
	 * @Description TODO
	 * @return 
	 * BigDecimal 
	 * @author lizhiqiang
	 * @date 2015-8-26-下午6:07:49
	 * @update 
	 * @throws
	 */
	public BigDecimal getSumThisMakeCreditValueByDealCode(DealDto dealdto);
	/**
	 * 查询二次购买需要确认的债权列表
	 * @Title getSecondBuyCreditConfirm
	 * @Description TODO
	 * @param dealDto
	 * @return 
	 * List<SecondBuyCreditConfirmDto> 
	 * @author lizhiqiang
	 * @date 2015-9-23-上午10:06:38
	 * @update 
	 * @throws
	 */
	public List<SecondBuyCreditConfirmDto> getSecondBuyCreditConfirm(DealDto dealDto);
	
	/**
	 * @Description 判断是否是受让债权
	 * @param creditCode 债权编号
	 * @param creditDetailDTO 受让债权
	 * @return true:是受让债权； false:不是受让债权
	 * @author shengzhoutao
	 * @date 2015-9-22 
	 */
	public boolean isSRCreditRight(final String creditCode, TCMmCreditDetailDTO creditDetailDTO);
	/**
	 * 选择赎回债权，转换指定日期的债权价值
	 * 
	 * @param creditDetailList
	 * @param redeemDate
	 * @return
	 */
	public List<TCMmCreditDetailDTO> getCreditDetailRedemptionListByInterface(List<TCMmCreditDetailDTO> creditDetailList, Date redeemDate);

	/**
	 * 赎回结算
	 * @Title doRedempSettleDeal
	 * @Description TODO
	 * @param dealCode
	 * @return 
	 * String 
	 * @author lizhiqiang
	 * @date 2016-4-18-上午11:07:21
	 * @update 
	 * @throws
	 */
	public String doRedempSettleDeal(DealDto dealdto);
	
	/**
	 * 批量更新结算状态
	 * @Title updateCreditDealDetailCostState
	 * @Description TODO
	 * @param cdlist
	 * @param paramMap 
	 * void 
	 * @author lizhiqiang
	 * @date 2016-4-19-上午11:56:59
	 * @update 
	 * @throws
	 */
	public void updateCreditDealDetailCostState(List<CreditDetailDto> cdlist,Map<Object , Object> paramMap);

	
	/**
	 * *******************************************二次购买-Plus ******************
	 */
	/**
	 * 二次购买--正常月还 Plus
	 * @Description 
	 * @return   
	 * List<CreditTwoBuyRepayDto>  
	 * @throws
	 * @author zhangmi
	 * @date 2016-4-25
	 */
	public List<CreditTwoBuyRepayDto> getCreditTwoBuyRepayList(DealDto dealDto); 
	
	/**
	 * 二次购买--提前结清Plus
	 * @Description 
	 * @param dealDto
	 * @return   
	 * List<CreditTwoBuySettleDto>  
	 * @throws
	 * @author zhangmi
	 * @date 2016-4-25
	 */
	public List<CreditTwoBuySettleDto> getCreditTwoBuySettleList(DealDto dealDto); 
	
	/**
	 * 二次购买--新匹配债权列表
	 * @Description 
	 * @param dealDto
	 * @return   
	 * List<CreditTwoBuyMatchDto>  
	 * @throws
	 * @author zhangmi
	 * @date 2016-4-25
	 */
	public List<CreditTwoBuyMatchDto> getCreditTwoBuyMatchList(DealDto dealDto); 
	public void updateCreditDetailCreditorStatus(DealDto dealDto);
	/**
	 * 债权赎回接口-对外系统
	 * @author zhangmi
	 * @date  2017年1月11日
	 * @param creditList
	 * @throws Exception
	 */
	public String doReceiveCreditRedemption(List<RequestCreditRedemptionListDTO> creditList) throws Exception;
	
	/**
	 * 二次购买（插入债权明细）
	 * @author zhangmi
	 * @date  2017年2月27日
	 * @param list
	 * @param dealdto
	 */
	public void saveCreditDetailBySecond(List<CreditDetailSecondDto> list,DealDto dealdto);
	/**
	 * 二次购买（插入债权交易明细）
	 * @author zhangmi
	 * @date  2017年2月27日
	 * @param list
	 * @param dealdto
	 */
	public void saveCreditDealDetailBySecond(List<CreditDetailSecondDto> list,DealDto dealdto);
	/**
	 * 二次购买（插入债权额度明细）
	 * @author zhangmi
	 * @date  2017年2月27日
	 * @param list
	 * @param dealdto
	 */
	public void saveQuotaCreditDetailBySecond(List<CreditDetailSecondDto> list,DealDto dealdto);
}